package br.edu.com1263.dao;

import java.util.Collection;

import javax.persistence.Query;

import br.edu.com1263.model.Horario;

public class HorarioDAOImpl extends AbstractDAO implements HorarioDAO{
	
	public HorarioDAOImpl(){
		
	}
	
	public void salvar(Horario horario) {
        manager.persist(horario);
    }
    
    public void alterar(Horario horario) {
		manager.merge(horario);
	}
    
    public void remover(Horario horario) {
		manager.remove(horario);
	}

	@Override
	public Horario consultar(Long id) {
		return manager.find(Horario.class, id);
	}

	@Override
	public Collection<Horario> consultarTodos() {
		Query query = manager.createQuery("SELECT h FROM Horario h");
		return query.getResultList();
	}

}
